package com.peg.rules;

import com.peg.dataobjects.Context;

/**
 * @author sad
 */
public class DebugPrintAction extends Rule {

    private String _message;
    private boolean _newLine;

    public DebugPrintAction(String message, boolean newLine) {
        _message = message;
        _newLine = newLine;
    }

    @Override
    public boolean execute(Context context) {
        if (_newLine) {
            System.out.println(_message);
        } else {
            System.out.print(_message);
        }
        return true;
    }

    @Override
    public String toString() {
        return "DebugPrint [" + _message + "]";
    }
}
